/**    
 * 文件名：WeixinSign.java    
 *    
 * 版本信息：    
 * 日期：2015-7-27    
 * Copyright inspursoftware Corporation 2015     
 * 版权所有    
 *    
 */
package com.thinkgem.jeesite.common.utils.wx;

import java.util.Map;

/**    
 *     
 * 项目名称：ALM_eb_web    
 * 类名称：WeixinSign    
 * 类描述：    
 * 创建人：zhaoshuhe    
 * 创建时间：2015-7-27 下午3:47:34    
 * @version     
 *     
 */
public class WeixinSign {
    public  static String getWeixinPaySign(Map<String, String> paramMap){
        StringBuilder strA = new StringBuilder();
        strA = strA.append("appid="+paramMap.get("appid"))
                .append("&attach="+paramMap.get("attach"))
                .append("&body="+paramMap.get("body"))
                .append("&detail="+paramMap.get("detail"))
                .append("&mch_id="+paramMap.get("mch_id"))
                .append("&nonce_str="+paramMap.get("nonce_str"))
                .append("&notify_url="+paramMap.get("notify_url"))
                .append("&out_trade_no="+paramMap.get("out_trade_no"))
                .append("&spbill_create_ip="+paramMap.get("spbill_create_ip"))
                .append("&total_fee="+paramMap.get("total_fee"))
                .append("&trade_type="+paramMap.get("trade_type"));
        strA = strA.append("&key="+paramMap.get("appKey"));
        String sign = MD5.MD5Encode(strA.toString()).toUpperCase();
        return sign;
    }
    public  static String getWeixinRefundSign(Map<String, String> paramMap){
        StringBuilder strA = new StringBuilder();
        strA = strA.append("appid="+paramMap.get("appid"))
                .append("&mch_id="+paramMap.get("mch_id"))
                .append("&nonce_str="+paramMap.get("nonce_str"))
                .append("&op_user_id="+paramMap.get("op_user_id"))
                .append("&out_refund_no="+paramMap.get("out_refund_no"))
                .append("&out_trade_no="+paramMap.get("out_trade_no"))
                .append("&refund_fee="+paramMap.get("refund_fee"))
                .append("&total_fee="+paramMap.get("total_fee"));
        strA = strA.append("&key="+paramMap.get("appKey"));
        String sign = MD5.MD5Encode(strA.toString()).toUpperCase();
        return sign;
    }
    
    public  static String getWeixinPaySignGZ(Map<String, String> paramMap){
        StringBuilder strA = new StringBuilder();
        strA = strA.append("appid="+paramMap.get("appid"))
                .append("&attach="+paramMap.get("attach"))
                .append("&body="+paramMap.get("body"))
                .append("&mch_id="+paramMap.get("mch_id"))
                .append("&nonce_str="+paramMap.get("nonce_str"))
                .append("&notify_url="+paramMap.get("notify_url"))
                .append("&openid="+paramMap.get("openId"))
                .append("&out_trade_no="+paramMap.get("out_trade_no"))
                .append("&spbill_create_ip="+paramMap.get("spbill_create_ip"))
                .append("&total_fee="+paramMap.get("total_fee"))
                .append("&trade_type="+paramMap.get("trade_type"));
        strA = strA.append("&key="+paramMap.get("appKey"));
        String sign = MD5.MD5Encode(strA.toString()).toUpperCase();
        return sign;
    }
    
    public  static String getGZSign(Map<String, String> paramMap){
        StringBuilder strA = new StringBuilder();
        strA = strA.append("appId="+paramMap.get("appId"))
                .append("&nonceStr="+paramMap.get("nonceStr"))
                .append("&package="+paramMap.get("package2"))
                .append("&signType="+paramMap.get("signType"))
                .append("&timeStamp="+paramMap.get("timeStamp"));
        strA = strA.append("&key="+paramMap.get("appKey"));
        String sign = MD5.MD5Encode(strA.toString()).toUpperCase();
        return sign;
    }
}
